<template>
  <!-- <div> -->
  <uni-popup ref="delpop">
    <div class="relative h-550rpx w-550rpx overflow-hidden rounded-30rpx">
      <div class="h-92rpx" />
      <div class="h-480rpx min-h-500rpx w-548rpx">
        <image class="h-full w-550rpx -mt-92rpx" :src="`${cdnUrl}/imgs/detail/deletebg.png${imgVersion}`" mode="scaleToFill" />
        <div class="absolute left-0 right-0 top-20rpx text-center">
          <div class="mb-12% mt-43% text-36rpx font-bold text-hex-333333">{{ title }}</div>
          <div class="flex justify-around rounded-b-30rpx bg-hex-ffffff pb-32rpx">
            <div class="btn-normal-bg h-68rpx w-182rpx rounded-16rpx text-28rpx leading-68rpx" @click="handleCancel">{{ cancle }}</div>
            <div class="btn-theme-bg h-68rpx w-182rpx rounded-16rpx text-center text-28rpx leading-68rpx" @click="handleConfirm">{{ sure }}</div>
          </div>
        </div>
      </div>
    </div>
  </uni-popup>
  <!-- </div> -->
</template>

<script lang='ts' setup>
let title = $ref()
let sure = $ref('')
let cancle = $ref('')
let resolveFunc
// 删除弹窗
const delpop: any = $ref('')

const showConfirm = (ti, textObj = { sure: '确认', cancle: '取消' }) => {
  title = ti
  sure = textObj.sure
  cancle = textObj.cancle
  delpop.open('center')
  return new Promise((resolve, reject) => {
    resolveFunc = resolve
  })
}
const handleConfirm = () => {
  delpop.close()
  resolveFunc(true)
}

const handleCancel = () => {
  delpop.close()
  resolveFunc(false)
}

defineExpose({
  showConfirm,
})
</script>

<style lang='scss'>
</style>
